package org.ymh.unix_file_system.domain;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class INode  {//i节点号是隐藏的

    /**
     * 0为普通文本
     * 1为目录文件
     * 2为块设备
     * 3为通道文件
     */
    public byte type;//类型
    public short[] address;//物理块（13项）
    public int fileLength;//文件长度（KB,向上取整)
    public byte count;//连接节点

    public INode(byte type)
    {
        this.type=type;
        address=new short[13];
        fileLength=0;
        count=0;
    }
    public INode() {
        type=0;
        address=new short[13];
        fileLength=0;
        count=0;
    }

    public INode(byte type, int fileLength, byte count) {
        this.type = type;
        this.fileLength = fileLength;
        this.count = count;
        address=new short[13];
    }
    public INode(INode iNode)
    {
        this.type=iNode.type;
        this.count=iNode.count;
        this.fileLength=iNode.fileLength;
        this.address=iNode.address;
    }
    public void copy(INode iNode)
    {
        this.type=iNode.type;
        this.count=iNode.count;
        this.fileLength=iNode.fileLength;
        this.address=iNode.address;
    }

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public short[] getAddress() {
        return address;
    }

    public void setAddress(short[] address) {
        this.address = address;
    }

    public int getFileLength() {
        return fileLength;
    }

    public void setFileLength(int fileLength) {
        this.fileLength = fileLength;
    }

    public byte getCount() {
        return count;
    }

    public void setCount(byte count) {
        this.count = count;
    }


}
